package com.itheima.controller;

import com.itheima.common.CommonResult;
import com.itheima.service.SetmealService;
import com.itheima.vo.PhoneSetmealDishVo;
import com.itheima.vo.PhoneSetmealVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author YangJiaHao
 */
@RestController
@RequestMapping("/setmeal")
public class SetmealController {
    @Autowired
    private SetmealService setmealService;

    @GetMapping("/list")
    public CommonResult getPhoneSetmealVo(String categoryId,Integer status){
        List<PhoneSetmealVo> phoneSetmealVo = setmealService.getPhoneSetmealVo(categoryId,status);
        return CommonResult.success(phoneSetmealVo);
    }

    @GetMapping("/dish/{id}")
    public CommonResult getSetmealDish(@PathVariable String id){
        PhoneSetmealDishVo phoneSetmealDishVo = setmealService.getPhoneSetmealDish(id);
        return CommonResult.success(phoneSetmealDishVo);
    }
}
